package com.jdrx.sw.sewage.remote;

import java.util.Map;

import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Service;

import com.google.common.collect.Maps;
import com.jdrx.ocp.beans.commons.SysConstant;
import com.jdrx.platform.dubbo.common.beans.DubboRpcBean;
import com.jdrx.platform.dubbo.common.service.IDubboRpcService;

@Service
public class TenantUserRemote {
	@Reference(group = "${group.app.name.tenant}", check = false)
    private IDubboRpcService iDubboRpcService;
	
	public void add(Long tenantId, String dataNode, String userName) throws Exception {
		Map<String, Object> paramMap = Maps.newHashMap();
		paramMap.put("tenantId", tenantId);
		paramMap.put("userName", userName);
		
		DubboRpcBean rpcBean = DubboRpcBean.builder().setRpcPath("/api/tenantUser/add")
				.setHeader(SysConstant.TENANT_ID, tenantId)
				.setBody(paramMap)
				.build();
		RemoteUtil.parseReturnData(iDubboRpcService.callback(rpcBean));
	}
}